package model.xml;

import java.util.Comparator;

import model.ModelComponent;

public class LayerComparator implements Comparator<ModelComponent>{

	@Override
	/**
	 * Compara dois modelcomponents pela layer
	 * @return int
	 */
	public int compare(ModelComponent sc1, ModelComponent sc2) {
		int layer1 = sc1.getLayer().getCode();
		int layer2 = sc2.getLayer().getCode();
		if(layer1 > layer2){
			return -1;
		}else if(layer1 < layer2){
			return 1;
		}	
		return 0;
	}

}
